<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/style/basic_layout.css" rel="stylesheet" type="text/css">
<link href="/style/common_style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/js/jquery/jquery.js"></script>
<script src="/js/plugins/artDialog/jquery.artDialog.js?skin=blue"></script>
<script src="/js/plugins/My97DatePicker/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/js/commonAll.js"></script>
<title>WMS-订单管理</title>
<style>
	.alt td{ background:black !important;}
</style>
</head>
<body>
	<form id="searchForm" action="/orderBill/list.do" method="post">
		<div id="container">
			<div class="ui_content">
				<div class="ui_text_indent">
					<div id="box_border">
						<div id="box_top">搜索</div>
						<div id="box_center">
							业务时间
							<fmt:formatDate value="${qo.beginTime}" var="beginTime"/>
							<input type="text" class="ui_input_txt02 Wdate" name="beginTime" value="${beginTime}"/>~
							<fmt:formatDate value="${qo.endTime}" var="endTime"/>
							<input type="text" class="ui_input_txt02 Wdate" name="endTime" value="${endTime}"/>
							<script>
								$(function () {
								    //绑定点击事件
									$(".Wdate").click(function () {
										WdatePicker({
                                            readOnly:true,
                                            maxDate:new Date(),
										});
                                    });
                                });
							</script>
							供应商
							<select id="supplier" class="ui_select01" name="supplierId">
								<option value="-1">全部</option>
								<c:forEach var="sp" items="${suppliers}">
									<option value="${sp.id}">${sp.name}</option>
								</c:forEach>
							</select>
							状态
							<select id="status" class="ui_select01" name="status">
								<option value="-1">全部</option>
								<option value="1">未审核</option>
								<option value="2">已审核</option>
							</select>
						</div>
						<script>
							$("#supplier option[value='${qo.supplierId}']").prop("selected",true);
							$("#status option[value='${qo.status}']").prop("selected",true);
						</script>
						<div id="box_bottom">
							<input type="button" value="查询" class="ui_input_btn01 but_page"/>
							<input type="button" value="新增" class="ui_input_btn01 btn_input"
							data-url="/orderBill/input.do"/>
						</div>
					</div>
				</div>
			</div>
			<div class="ui_content">
				<div class="ui_tb">
					<table class="table" cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
						<tr>
							<th width="30"><input type="checkbox" id="all" /></th>
							<th>采购单号</th>
							<th>业务时间</th>
							<th>供应商</th>
							<th>总数量</th>
							<th>总金额</th>
							<th>录入人</th>
							<th>审核人</th>
							<th>状态</th>
							<th></th>
						</tr>
						<c:forEach var="entiry" items="${result.data}" varStatus="num">
							<tr>
								<td><input type="checkbox" class="acb" /></td>
								<td>${entiry.sn}</td>
								<td><fmt:formatDate value="${entiry.vdate}"/></td>
								<td>${entiry.supplier.name}</td>
								<td>${entiry.totalNumber}</td>
								<td>${entiry.totalAmount}</td>
								<td>${entiry.inputUser.name}</td>
								<td>${entiry.auditor.name}</td>
								<td>
									<c:choose>
										<c:when test="${entiry.status == 1}">
											<span style="color: red">未审核</span>
										</c:when>
										<c:when test="${entiry.status == 2}">
											<span style="color: #11777C">已审核</span>
										</c:when>
									</c:choose>
								</td>
								<td>
									<c:choose>
										<c:when test="${entiry.status == 1}">
											<a href="/orderBill/input.do?id=${entiry.id}">编辑</a>
											<a href="javascript:" class="btn_delete"
											   data-url="/orderBill/delete.do?id=${entiry.id}">删除</a>
											<a href="javascript:" class="btn_audit"
											   data-url="/orderBill/audit.do">审核</a>
											<script>
												$(function () {
													$(".btn_audit").click(function () {
														var url = $(this).data("url");
													    showDialog("您确定要审核吗!",function () {
													        //发送ajax请求
													        $.get(url,{orditId:"${entiry.id}"},function (data) {
																showDialog("审核成功!",function () {
																    //刷新界面
																	location.reload();
                                                                });
                                                            });
                                                        },true);
                                                    });
                                                });
											</script>
										</c:when>
										<c:when test="${entiry.status == 2}">
											<a href="/orderBill/view.do?id=${entiry.id}">查看</a>
										</c:when>
									</c:choose>
								</td>
							</tr>
						</c:forEach>
					</table>
				</div>
				<%--引入分页操作--%>
				<%@ include file="/WEB-INF/views/common/page.jsp" %>
			</div>
		</div>
	</form>
</body>
</html>
